<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<script type="text/javascript">
$(function() {
	init();
	function init(){
		$.ajax({
			type:"POST",
			url: path+'local/getCollectInfo',
			data:{nodeIp:$("#nodeIp").val()},
			success: function(result){
				if(result){
					for(var item in result.result){
						var appendStr ="<tr>";
						if(result.result[item].files["/"].length>0){
							var objFile = result.result[item].files["/"][result.result[item].files["/"].length-1];
							var str = objFile.used_p*100+'%<br />'+(parseFloat(objFile.used)/1024/1024/1024).toFixed(2)+'G/'+(parseFloat(objFile.total)/1024/1024/1024).toFixed(2)+'G';
							appendStr+="<td>"+str+"</td>";
						}else{
							appendStr+="<td></td>";
						}
						
						if(result.result[item].files["/boot"].length>0){
							var objFile = result.result[item].files["/boot"][result.result[item].files["/boot"].length-1];
							var str = objFile.used_p*100+'%<br />'+(parseFloat(objFile.used)/1024/1024/1024).toFixed(2)+'G/'+(parseFloat(objFile.total)/1024/1024/1024).toFixed(2)+'G';
							appendStr+="<td>"+str+"</td>";
						}else{
							appendStr+="<td></td>";
						}
						
						if(result.result[item]["cpu"].length>0){
							var objFile = result.result[item]["cpu"][result.result[item]["cpu"].length-1];
							var str = objFile.idle+'<br />'+objFile.user_p*100+'%/'+(objFile.system_p*100).toFixed(2)+'%';
							appendStr+="<td>"+str+"</td>";
						}else{
							appendStr+="<td></td>";
						}
						
						
						if(result.result[item]["mem"].length>0){
							var objFile = result.result[item]["mem"][result.result[item]["mem"].length-1];
							var str = objFile.used_p*100+'%<br />'+(parseFloat(objFile.used)/1024/1024/1024).toFixed(2)+'G/'+(parseFloat(objFile.total)/1024/1024/1024).toFixed(2)+'G';
							appendStr+="<td>"+str+"</td>";
						}else{
							appendStr+="<td></td></tr>";
						}
						
						if(result.result[item]["swap"].length>0){
							var objFile = result.result[item]["swap"][result.result[item]["swap"].length-1];
							var str = objFile.used_p*100+'%<br />'+(parseFloat(objFile.used)/1024/1024/1024).toFixed(2)+'G/'+(parseFloat(objFile.total)/1024/1024/1024).toFixed(2)+'G';
							appendStr+="<td>"+str+"</td>";
						}else{
							appendStr+="<td></td></tr>";
						}
						
						$("#infoTbody").append(appendStr);
					}
				}
			}
		});
	}
});
</script>
<div class="box-header with-border">
	<h3 class="box-title">${nodeIp } / NODE${localId }</h3>
	<!-- /.box-tools -->
</div>
<div class="box box-primary">
	<div class="box-header with-border">
		<h3 class="box-title">服务器状态</h3>
		<!-- /.box-tools -->
	</div>
	<!-- /.box-header -->
	<div class="box-body no-padding">
		<div class="table-responsive mailbox-messages">
			<table class="table table-bordered table-hover">
				<thead>
					<tr style="background-color: #f9f9f9;">
						<th>状态</th>
						<th>48小时告警数</th>
						<th>未恢复告警数</th>
					</tr>
				</thead>
				<tbody>
					<tr>
						<td>OK</td>
						<td>4</td>
						<td>1</td>
					</tr>
				</tbody>
			</table>
			<!-- /.table -->
		</div>
		<!-- /.mail-box-messages -->
	</div>
	<!-- /.box-body -->

</div>
<div class="box box-primary">
	<div class="box-header with-border">
		<h3 class="box-title">资源占用率</h3>
		<!-- /.box-tools -->
	</div>
	<!-- /.box-header -->
	<div class="box-body no-padding">
		<div class="table-responsive mailbox-messages">
			<table class="table table-bordered table-hover">
				<thead>
					<tr style="background-color: #f9f9f9;">
						<th>/</th>
						<th>/boot</th>
						<th>cpu</th>
						<th>物理内存</th>
						<th>Swap空间</th>
					</tr>
				</thead>
				<tbody id="infoTbody">
					
				</tbody>
			</table>
			<!-- /.table -->
		</div>
		<!-- /.mail-box-messages -->
	</div>
	<!-- /.box-body -->
</div>
<input id="localId" type="hidden" value="${localId }">
<input id="nodeIp" type="hidden" value="${nodeIp }">
